package com.example.tests;

import org.testng.annotations.Test;
import com.example.pages.LoginPage;
import com.example.pages.ProfilePage;

public class ChangePasswordTest extends TestBase {

	@Test
	public void testChangePassword() throws InterruptedException {
		ProfilePage change = goToMainPage()
				.logInwithValidCredentials(login, oldPass).goToProfilePage()
				.changePassWrong(newPass, incorrectConfirmPass);
		if (!verify(change.error)) {
			fail("There is no error message when the confirmation password is incorrect");
		}
		LoginPage loginAgain = change.changePass(newPass, newPass).logOut();
		loginAgain.logInwithWrongCredentials(login, oldPass)
				.logInwithValidCredentials(login, newPass).goToProfilePage()
				.changePass(oldPass, oldPass).logOut();
	}

}